﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SuperSocket.SocketBase.Command;
using Newtonsoft.Json;
using SuperSocket.SocketBase;
using SuperWebSocket.SubProtocol;

namespace _21SocketServer.Command
{
    /// <summary>
    /// 派牌
    /// </summary>
    public class SHUFFLE 
    {
        public static void Execute(I21Session session, CommandInfo<string> commandInfo)
        {
            CardLib lib = new CardLib();
            lib.Shuffle();

            session.Command(string.Format("SHUFFLE {0}", JsonConvert.SerializeObject(new { List = lib.List })));
        }
    }

    public class SHUFFLE_S : StringCommandBase<_21Session>
    {
        public override string Name
        {
            get
            {
                return "SHUFFLE";
            }
        }

        public override void ExecuteCommand(_21Session session, StringCommandInfo commandInfo)
        {
            SHUFFLE.Execute(session, commandInfo);
        }
    }

    public class SHUFFLE_WS : SubCommandBase<_21WebSession>
    {
        public override string Name
        {
            get
            {
                return "SHUFFLE";
            }
        }

        public override void ExecuteCommand(_21WebSession session, SubRequestInfo requestInfo)
        {
            SHUFFLE.Execute(session, requestInfo);
        }

    }
}
